import React from "react"
import "./Todoheader.css"
export default class Todoheader extends React.Component {
    render() {
        return (
            <div className="todo-header">
                <input type="text" placeholder="请输入你的任务名称，按回车键确认" onKeyDown={this.change} />
            </div>
        )
    }
    change = (e) => {
        if (e.keyCode === 13) {
            this.props.addTodo(e.target.value)
            e.target.value = "";
        }

    }
}